<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .container {
            width: 400px;
            margin: 0 auto;
        }

        h1 {
            text-align: center;
            padding: 20px 0;
        }

        p {
            color: #666;
            text-align: center;
            font-size: 14px;
            padding: 10px 0;
        }

        .row {
            height: 40px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        span {
            width: 100px;
            line-height: 40px;
        }

        .edit {
            width: 200px;
            height: 30px;
        }

        .submit {
            width: 304px;
            height: 40px;
            color: white;
            background-color: orange;
            border: none;
        }
    </style>
    <script src="./jquery-3.7.1.min.js"></script>
</head>

<body>
    <div class="container">
        <h1>表⽩墙</h1>
        <p>输⼊后点击提交, 会将信息显⽰在表格中</p>
        <div class="row">
            <span>谁: </span>
            <input class="edit" type="text" id="text1">
        </div>
        <div class="row">
            <span>对谁: </span>
            <input class="edit" type="text" id="text2">
        </div>
        <div class="row">
            <span>说什么: </span>
            <input class="edit" type="text" id="text3">
        </div>
        <div class="row">
            <input type="button" value="提交" class="submit">
        </div>
        <ul id="ul1" style="text-align: center;">

        </ul>
    </div>
    <script>
        $(document).ready(function(){
            $("input:button").click(function(){
                let who=$("#text1").val();
                let towho=$("#text2").val();
                let say=$("#text3").val();
                if(who==""||towho==""||say==""){
                    alert("内容不能为空")
                    return;                   
                }
                let content=who+"对"+towho+"说"+say;
                $("#ul1").append("<li>"+content+"</li>")
                $(".edit").val("");
            })
        });
    </script>
</body>

</html>